<template>
  <view class="height-card" @click="consultantOnline">
    <view class="top">
      <view class="name">{{ info.iname }}</view>
      <view class="avatar-box">
        <image class="avatar" :src="info.pic || defaultAvatar"></image>
        <view class="online" v-if="info.isOnline == 1">在线</view>
      </view>
      <view class="score-box">
        <image :src="littleStar" class="img"></image>
        <text class="score">{{ info.star }}</text>
      </view>
      <view class="count-box">
        <text class="mt16">服务过{{ info.serviceCount }}</text>
      </view>
    </view>
    <view class="btn">
      <image :src="message" class="message"></image>
      <text class="text">在线咨询 ＞</text>
    </view>
  </view>
</template>

<script>
export default {
  components: {},
  name: 'HeightCard',
  props: {
    info: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      defaultAvatar: this.$imgBase + 'common/avatar_default.png',
      littleStar: this.$imgBase + 'career/littleStar.png',
      message: this.$imgBase + 'career/message.png'
    };
  },
  onLoad(opt) {},
  onShow() {},
  created() {},
  mounted() {},
  methods: {
    consultantOnline() {
      this.$emit('consultantOnline', this.info.consultantId);
    }
  }
};
</script>
<style lang="scss" scoped>
.height-card {
  padding-top: 24rpx;
  border-radius: 8rpx;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 212rpx;
  background: linear-gradient(180deg, #ffcaa0 0%, #ffffff 78%);
  .top {
    display: flex;
    flex-direction: column;
    align-items: center;
    .name {
      font-size: 30rpx;
      color: #222;
      font-weight: 600;
    }
    .avatar-box {
      margin-top: 16rpx;
      position: relative;
      .avatar {
        width: 122rpx;
        height: 122rpx;
        border-radius: 50%;
        border: 2rpx solid #fff;
      }
      .online {
        position: absolute;
        bottom: 0;
        left: 18rpx;
        border-radius: 25rpx;
        padding: 2rpx 20rpx;
        color: #fff;
        border: 2rpx solid #fff;
        background-color: #26c467;
        font-size: 24rpx;
      }
    }
    .score-box {
      display: flex;
      align-items: center;
      margin: 10rpx 8rpx 10rpx 0;
      .img {
        width: 28rpx;
        height: 28rpx;
        margin-right: 8rpx;
      }
      .score {
        font-size: 28rpx;
        color: #333;
        font-weight: 600;
      }
    }
    .count-box {
      font-size: 24rpx;
      color: #b77238;
    }
  }
  .btn {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ffefd7;
    border-radius: 12rpx;
    color: #f76c3e;
    font-size: 24rpx;
    margin-top: 16rpx;
    width: 100%;
    height: 56rpx;
    line-height: 56rpx;
    .message {
      width: 28rpx;
      height: 28rpx;
    }
    .text {
      padding: 0 16rpx;
      font-weight: 600;
    }
  }
}
</style>
